package org.irri.smta.scheduler;

import javax.inject.Inject;
import javax.inject.Named;

import org.irri.smta.config.impl.Configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component("configLoaderWorker")
public class ConfigLoaderWorker extends Worker {

	private static final Logger LOGGER = LoggerFactory.getLogger(ConfigLoaderWorker.class);
	
	@Inject
	@Named("configuration")
	private Configuration configuration;

	@Override
	public void execute() {
		LOGGER.debug("execute()");
		String threadName = Thread.currentThread().getName();
		LOGGER.debug("Executing thread: " + threadName);
		if (configuration != null) {
			configuration.load();
		}
		LOGGER.debug("Thread execution completed: " + threadName);

}

}
